package br.iars.model.entity;

import javax.persistence.AttributeOverride;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

@Entity
@Table(name="item")
@AttributeOverride( name="id", column = @Column(name="item_id") )
public class Item extends GenericEntity<Long> {

	private static final long serialVersionUID = -5713853719773651648L;

	@Column(name = "context_item_id", nullable = false)
	private Long code;
	
	@ManyToOne
	@JoinColumn(name="context_id")
	private Context context;

	public Item() {
		super();
	}

	public Item(Long id) {
		super(id);
	}

	public Item(Long code, Context context) {
		super();
		this.code = code;
		this.context = context;
	}

	public Long getCode() {
		return code;
	}

	public void setCode(Long code) {
		this.code = code;
	}

	public Context getContext() {
		return context;
	}

	public void setContext(Context context) {
		this.context = context;
	}

	@Override
	public String toString() {
		return "Item [code=" + code + ", context=" + context + ", getId()=" + getId() + "]";
	}

	

}
